const path = require("path");

const selectIP = 'http://120.55.72.217'
module.exports = {
    productionSourceMap: false,
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
            config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
            config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
            config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
        }
        return {
            resolve: {
                alias: {
                    "@": path.resolve(__dirname, "src"),
                },
            }
        }
    },
    devServer: {
        port: 9999,
        open: true,
        disableHostCheck: true,
        proxy: {
            "/api": {
                target: selectIP,
                changeOrigin: true,
                logLevel: "debug",
                pathRewrite: {
                    "^/api/": "/"
                }
            }
        }
    },
};